<?php


namespace app\admin\controller\virtual;


use think\Request;
use app\admin\model\RobotSet as RobotSetModel;

class RobotSet
{
    public function getSet(Request $request)
    {
         $res = RobotSetModel::GetSet() == null ? "" : RobotSetModel::GetSet();
         return successJson("success",$res);
    }

    public function addSet(Request $request)
    {
        $name = $request->param("name","");
        $sex = $request->param("sex","");
        $icon = $request->file("icon");
//        $start = $request->param("start_time",0);
//        $end = $request->param("end_time",0);
        $time = $request->param("time",[]);
//        print_r($time);exit();
        if(empty($time))return "传入正确时间";
        $res = RobotSetModel::saveOne($name,$icon,$sex,$time);
        if($res){
            return failedJson($res);
        }
        return successJson("success","成功`");
    }
}